# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ubertooth
pkgver=2020.12.R1
pkgrel=7
groups=('blackarch' 'blackarch-bluetooth')
pkgdesc='A 2.4 GHz wireless development board suitable for Bluetooth experimentation. Open source hardware and software. Tools only.'
url='https://github.com/greatscottgadgets/ubertooth/releases'
arch=('x86_64' 'aarch64')
license=('GPL')
depends=('libusb' 'libbtbb' 'bluez-libs' 'libpcap' 'python' 'python-numpy'
         'python-pyside' 'python-pyqt4' 'python-pyusb')
makedepends=('cmake' 'python-setuptools')
source=("https://github.com/greatscottgadgets/ubertooth/archive/${pkgver//./-}.tar.gz")
sha512sums=('86dab6cc8db026663783c022670859bdcaadfb22373ce418508de24297c439ec49a4236c49bbf03e956c8cf5f463231003badd7f8146c13d1891ab739874a24f')

prepare() {
  cd "$pkgname-${pkgver//./-}/host"

  find "$srcdir/" -name "*.py" -exec sed -i 's|env python|env python|' {} \;
  find "$srcdir/" -name "*.py" -exec \
    sed -i 's|/usr/bin/python|/usr/bin/python|' {} \;
}

build() {
  cd "$pkgname-${pkgver//./-}/host"

  mkdir -p build

  cd build

  cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python \
    -DCMAKE_INSTALL_PREFIX:PATH=/usr ..

  make
}

package() {
  cd "$pkgname-${pkgver//./-}/host"

  cd build

  make DESTDIR="$pkgdir" install
}

